<template>
	<view>
		<view class="search">
			<input type="text" v-model="value" focus="true" placeholder="搜索菜谱或食材"/>
			<view class="submit" @click="submit(value)">
				确认
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value:''
			}
		},
		methods: {
			submit(v){
				if(v !==''){
					uni.navigateTo({
					     url:`/pages/search/searchGet?name=${this.value}`
					 })
				}else{
					console.log(1);
				}
			},
			
		},
	}
</script>

<style lang="scss">
	.search{
		width: 93vw;
		padding: 10px 12px;
		height: 100px;
		position: relative;
		input{
			background-color: rgba(153, 153, 153, 0.2);
			border-radius: 8px;
		}
		.submit{
			width: 40px;
			height: 20px;
			border-radius: 5px;
			font-size: 12px;
			position: absolute;
			top: 12px;
			// transform: translateY(50%);
			background-color: #fff;
			right: 0;
		}
	}
</style>